package com.lzw.breezeNovel.webApp.controller.novel;

import com.lzw.breezeNovel.common.result.Result;
import com.lzw.breezeNovel.webApp.service.novel.CategoryService;
import com.lzw.breezeNovel.webApp.vo.common.CategoryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.controller
 * @date 2025/3/2
 * @description 分类的控制类
 */
@RestController
@RequestMapping("/app/category")
@SuppressWarnings("all")
public class CategoryController {
    /**
     * 注入分类服务
     */
    @Autowired
    private CategoryService categoryService;

    /**
     * 根据看书人类型获取对应的类别
     */
    @GetMapping("/getCategoryByType")
    public Result<List<CategoryVo>> getCategoryByType(@RequestParam Integer type){
        List<CategoryVo> categoryVos =  categoryService.getCategoryByType(type);
        return Result.ok(categoryVos);
    }

}
